package com.ganhuoshitang.multipledatasources.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
/**
 * @author 公众号：干货食堂
 */
@Slf4j
public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        log.info("动态获取数据源——{}",DataSourceUtil.getDB());
        return DataSourceUtil.getDB();
    }
}
